package com.lefevre.cms.bean.topic;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.persistence.*;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
 * 标签
 *
 * @author Lefevre
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@TableName("tag")
@Entity
@Table(name = "tag", indexes = {@Index(name = "tag_1_idx", columnList = "sort")})
public class Tag implements Serializable {
    private static final long serialVersionUID = -7672182879689718269L;

    @Id
    @TableId(type = IdType.INPUT)
    private Long id;

    /**
     * 标签名称
     **/
    @Column(length = 190)
    private String name;

    /**
     * 排序
     **/
    private Integer sort = 0;

    /**
     * 标签下的话题允许查看的角色名称集合(默认角色除外)
     **/
    @Transient
    @TableField(exist = false)
    private List<String> allowRoleViewList = new ArrayList<>();

}
